{% extends "../inc/base.html" %}
{% block content %}
{%set cate = category.id|get_cate()%}
<!--
PAGE HEADER

CLASSES:
.page-header-xs	= 20px margins
.page-header-md	= 50px margins
.page-header-lg	= 80px margins
.page-header-xlg= 130px margins
.dark			= dark page header

.shadow-before-1 	= shadow 1 header top
.shadow-after-1 	= shadow 1 header bottom
.shadow-before-2 	= shadow 2 header top
.shadow-after-2 	= shadow 2 header bottom
.shadow-before-3 	= shadow 3 header top
.shadow-after-3 	= shadow 3 header bottom
-->
<section class="page-header page-header-xs" >
    <div class="container">

        <h1>{{category.title}}</h1>

        <!-- breadcrumbs -->
        <ol class="breadcrumb">
            <li><a href="/">首页</a></li>
            {%for val in breadcrumb %}
            {% if val.id == category.id %}
            <li class="active">{{val.title}}</li>
            {% else %}
            <li><a href="{{val.url}}">{{val.title}}</a></li>

            {% endif %}
            {% endfor %}
        </ol><!-- /breadcrumbs -->
    </div>
</section>
<!-- /PAGE HEADER -->
<!-- -->
<section >
    <div class="container">

        <!--分类信息-->
        {%if sort%}
        {%if sort.types|length >1%}
        <ul class="nav nav-tabs">
            {%for val in sort.types%}
            <li class="{%if sortid == val.enable%}active{%endif%}"><a href="{{cate.url}}-{{order}}-{{group_id}}-{{val.enable}}{{http.config('view.file_ext')}}" >{{val.name}}</a></li>
            {%endfor%}

        </ul>
        {%endif%}
        <div class="tab-content table-bordered" style="padding: 0; margin-bottom: 20px; margin-top: -1px">
            <table class="table table-hover  m-b-none" style="margin-top: -1px">
                <tbody>
                {% set typenum = 1%}
                {%for val in typevar%}
                {%if val.search > 1%}
                <tr {% if typenum > 3 %} class="type_tr_m"  style="display:none"{%endif%} >
                    <td style="width: 120px" class="text-right">
                        {{val.option.title}}:
                    </td>
                    <td>
                        {%if 0 == nsobj[val.option.identifier] or null == nsobj[val.option.identifier]%}
                        <span class="btn btn-danger btn-xs relative">全部</span>
                        {%else%}
                        <a href="{{cate.url}}-{{order}}-{{group_id}}-{{sortid}}-{{0|sort_url(val.option.identifier,typevar,nsobj)}}{{http.config('view.file_ext')}}" class="btn btn-clean btn-xs relative" >全部</a>
                        {%endif%}
                        {%for v in val.rules %}
                        {%if v.id|sort_act(nsobj[val.option.identifier])%}
                        <span class="btn btn-danger btn-xs relative" >{{v.name}}{{val.option.unit}}</span>
                        {%else%}
                        <a href="{{cate.url}}-{{order}}-{{group_id}}-{{sortid}}-{{v.id|sort_url(val.option.identifier,typevar,nsobj)}}{{http.config('view.file_ext')}}" class="btn btn-clean btn-xs relative" >{{v.name}}{{val.option.unit}}</a>
                        {%endif%}
                        {%endfor%}
                        <!--子栏目-->
                        {%for v in val.rules %}
                        {%if v.id|sort_act(nsobj[val.option.identifier])%}
                        {% if v.children%}
                        <div class="subtsm">

                            {% for v_ in v.children %}
                            {%if v_.id|sort_act(nsobj[val.option.identifier])%}
                            <span class="btn btn-danger btn-xs relative" >{{v_.name}}{{val.option.unit}}</span>
                            {%else%}
                            <a href="{{cate.url}}-{{order}}-{{group_id}}-{{sortid}}-{{v_.id|sort_url(val.option.identifier,typevar,nsobj)}}{{http.config('view.file_ext')}}" class="btn btn-clean btn-xs relative">{{v_.name}}{{val.option.unit}}</a>
                            {%endif%}
                            {% endfor %}
                        </div>
                        {%endif%}
                        {%endif%}
                        {%endfor%}
                        <!--子栏目-->
                        {%for v in val.rules %}
                        {%if v.id|sort_act(nsobj[val.option.identifier])%}
                        {% if v.children%}

                        {% for v_ in v.children %}
                        {%if v_.id|sort_act(nsobj[val.option.identifier])%}
                        {% if v_.children%}
                        <div class="subtsm">
                            {% for v__ in v_.children %}

                            {%if v__.id|sort_act(nsobj[val.option.identifier])%}

                            <span class="btn btn-danger btn-xs relative" >{{v__.name}}{{val.option.unit}}</span>
                            {%else%}
                            <a href="{{cate.url}}-{{order}}-{{group_id}}-{{sortid}}-{{v__.id|sort_url(val.option.identifier,typevar,nsobj)}}{{http.config('view.file_ext')}}" class="btn btn-clean btn-xs relative" >{{v__.name}}{{val.option.unit}}</a>

                            {%endif%}
                            {%endfor%}
                        </div>
                        {%endif%}
                        {%endif%}
                        {% endfor %}

                        {%endif%}
                        {%endif%}
                        {%endfor%}
                    </td>

                </tr>
                {% set typenum = typenum+1%}
                {%endif%}
                {%endfor%}

                </tbody>
            </table>
            {% if typenum > 4%}
            <a href="javascript:;" class="center-block btn btn-xs btn-white type_tr_b1" style="border-top: 1px solid #cfd8e1; display: block"><span class="fa fa-chevron-down"></span></a>
            <a href="javascript:;" class="center-block btn btn-xs btn-white type_tr_b2" style="border-top: 1px solid #cfd8e1; display: none"><span class="fa fa-chevron-up"></span></a>
            {%endif%}
        </div>

        {%endif%}
        <!--/分类信息-->
        <div class="row">

            <!-- LEFT -->
            <div class="col-md-9 col-sm-9">
                <div class="text-left">
                    <ul class="nav nav-pills mix-filter">

                        <li class="filter {%if group_id==0%}active{%endif%}"><a href="{{cate.url}}{{http.config('view.file_ext')}}">全部</a></li>
                        {% groups data="groups",cid=category.id%}
                        {%for v in groups%}
                        <li class="filter {%if group_id==v.id%}active{%endif%}"><a href="{{cate.url}}-{{order}}-{{v.id}}{%if sort%}-{{sortid}}{%endif%}{%if sorturl %}-{%endif%}{{sorturl}}{{http.config('view.file_ext')}}">{{v.name}}</a></li>
                        {%endfor%}
                    </ul>
                    <!--投稿按钮-->
                    <div class="btn-group btn-group-sm pull-right">
                        <a {%if model|length> 1 %} data-toggle="dropdown" {% endif %} class="btn btn-primary btn-sm document_add
                            dropdown-toggle {% if allow == 0 %}disabled{% endif %}" {%if model|length
                            == 1 %} href="/uc/publish/add/model_id/{{modellist[0].id}}/pid/0/cate_id/{{cate.id}}/group_id/{{group_id}}/sortid/{{sortid}}"{%endif%}
                            ><span class="fa fa-pencil-square-o"></span> 投稿 {%if model|length > 1 %}<span class="caret"></span>{% endif %}</a>
                        {%if model|length > 1 %}
                        <ul class="dropdown-menu">

                            {% for val in modellist%}
                            <li> <a href="/uc/publish/add/model_id/{{val.id}}/pid/0/cate_id/{{cate.id}}/group_id/{{group_id}}/sortid/{{sortid}}"
                                    class="text-info">添加{{val.title}}</a></li>
                            {% endfor %}

                            <!--<li class="divider"></li>-->
                            <!--<li><a href="#">添加内容</a></li>-->
                        </ul>
                        {% endif %}
                    </div>
                    <!--//投稿按钮-->
                    <div class="btn-group btn-group-sm pull-right">
                        <a class="btn btn-default height-auto {%if order<2%}active{%endif%}" href="{{cate.url}}-{%if order<2%}{{1-order}}{%else%}0{%endif%}{%if group_id or sort%}-{{group_id}}{%endif%}{%if sort%}-{{sortid}}{%endif%}{%if sorturl %}-{%endif%}{{sorturl}}{{http.config('view.file_ext')}}" >按时间 <span class="glyphicon {%if order ==0%}glyphicon-arrow-down{%elif order==1%}glyphicon-arrow-up{%else%}glyphicon-arrow-down{%endif%}"></span> </a>
                        <a class="btn btn-default height-auto {%if order>=2%}active{%endif%}" href="{{cate.url}}-{%if order>=2%}{%if order ==2%}3{%else%}2{%endif%}{%else%}2{%endif%}{%if group_id or sort%}-{{group_id}}{%endif%}{%if sort%}-{{sortid}}{%endif%}{%if sorturl %}-{%endif%}{{sorturl}}{{http.config('view.file_ext')}}" style="height: auto">按人气<span class="glyphicon  {%if order ==2%}glyphicon-arrow-down{%elif order==3%}glyphicon-arrow-up{%else%}glyphicon-arrow-down{%endif%}"></span></a>
                    </div>

                    <div class="divider divider-circle divider-center margin-top-0"><!-- divider -->
                        <a href="#"><i class="fa fa-rss"></i></a>
                    </div>
                </div>
                <div class="timeline">
                    <div class="timeline-hline"><!-- horizontal line --></div>
                    {% for val in list %}
                    {% set categoryname = val.category_id|get_cate %}
                    <!-- POST ITEM -->

                    <div class="blog-post-item padding-bottom-30 margin-bottom-30">
                        <div class="timeline-entry" style="height: 77px"><!-- .rounded = entry -->
                           <a href="#"><img src="/uc/index/avatar/uid/{{val.uid}}" style="width: 58px;height: 58px; margin-top: -10px"></a><span style="text-transform: none;overflow: hidden">{{val.uid|get_nickname}}</span>
                            <div class="timeline-vline"><!-- vertical line --></div>
                        </div>
                        <!-- IMAGE -->
                        {% if val.cover_id>0 %}
                        <figure class="blog-item-small-image margin-bottom-0">
                            <img class="img-responsive" src="{{val.cover_id|get_pic('m=1,w=200,h=120')}}" alt="">
                        </figure>
                        {% endif %}
                        <div class="blog-item-small-content">
                            <h2><a href="{{val.name|get_url(val.id)}}" target="_blank" title="{{val.title}}">{{val.title}}</a></h2>

                            <ul class="blog-post-info list-inline padding-bottom-10">
                                <li>
                                    <a href="#">
                                        <i class="fa fa-clock-o"></i>
                                        <span class="font-lato">{{val.update_time|dateformat('Y-m-d H:i')}}</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <i class="fa fa-comment-o"></i>
                                        <span class="font-lato">{{val.view}}</span>
                                    </a>
                                </li>
                                <li>
                                    <i class="fa fa-folder-open-o"></i>

                                    <a class="category" href="{{categoryname.url}}">
                                        <span class="font-lato">{{categoryname.name}}</span>
                                    </a>
                                </li>

                            </ul>

                            <p>{{val.description|truncate(90, true, "...")}}</p>
                        </div>
                    </div>

                    <!-- /POST ITEM -->
                    {%endfor%}

                </div>
                <!-- PAGINATION -->
                <div class="text-left">
                    <!-- Pagination Default -->
                    {{pagination | safe}}
                    <!-- /Pagination Default -->
                </div>
                <!-- /PAGINATION -->

            </div>

            <!-- RIGHT -->
            <div class="col-md-3 col-sm-3">

                <!-- INLINE SEARCH -->
                <div class="inline-search clearfix margin-bottom-10">
                    <form action="" method="get" class="widget_search">
                        <input type="search" placeholder="Start Searching..." id="s" name="s" class="serch-input">
                        <button type="submit">
                            <i class="fa fa-search"></i>
                        </button>
                    </form>
                </div>
                <!-- /INLINE SEARCH -->

                <hr />

                <!-- side navigation -->
                {%column data="column",pid=breadcrumb[0].id,isnum="1"%}
                {%if column|length >0%}
                <div class="side-nav margin-bottom-20 margin-top-20">
                    <div class="side-nav-head">
                        <button class="fa fa-bars"></button>
                        <h4>{{breadcrumb[0].title}}分类</h4>
                    </div>
                    <ul class="list-group list-group-bordered list-group-noicon uppercase">
                        {%for val in column%}
                        <li class="list-group-item  {%if val.id == category.id %}active{%endif%}"><a href="{{val.url}}{{http.config('view.file_ext')}}"><span class="size-11 text-muted pull-right">({{val.doc_num}})</span> {{val.name}}</a></li>
                        {%endfor%}
                    </ul>
                    <!-- /side navigation -->
                </div>
                {%endif%}


                <!-- JUSTIFIED TAB -->
                <div class="tabs nomargin-top hidden-xs margin-bottom-10">

                    <!-- tabs -->
                    <ul class="nav nav-tabs nav-bottom-border nav-justified">
                        <li class="active">
                            <a href="#tab_1" data-toggle="tab">
                                最热
                            </a>
                        </li>
                        <li>
                            <a href="#tab_2" data-toggle="tab">
                                最新
                            </a>
                        </li>
                    </ul>

                    <!-- tabs content -->
                    <div class="tab-content margin-bottom-0 margin-top-10">

                        <!-- POPULAR -->
                        <div id="tab_1" class="tab-pane active">
                            <!-- /post -->
                            {% topic data = "hotlist",limit= "5",cid=category.id,type="hot"%}
                            {%for v in hotlist%}
                            <div class="row tab-post"><!-- post -->
                                {%if v.cover_id%}
                                <div class="col-md-3 col-sm-3 col-xs-3">
                                    <a href="{{v.name|get_url(v.id)}}">
                                        <img src="{{v.cover_id|get_pic('m=1,w=50,h=50')}}" width="50" alt="" />
                                    </a>
                                </div>
                                {%endif%}
                                <div class="col-md-9 col-sm-9 col-xs-9">
                                    <a href="{{v.name|get_url(v.id)}}" class="tab-post-link">{{v.title}}</a>
                                    <small>{{v.update_time|dateformat('Y-m-d H:i')}}</small>
                                </div>
                            </div><!-- /post -->
                            {%endfor%}

                        </div>
                        <!-- /POPULAR -->


                        <!-- RECENT -->
                        <div id="tab_2" class="tab-pane">
                            {% topic data = "newlist",limit= "5",cid=category.id%}
                            {%for v in newlist%}
                            <div class="row tab-post"><!-- post -->
                                {%if v.cover_id%}
                                <div class="col-md-3 col-sm-3 col-xs-3">
                                    <a href="{{v.name|get_url(v.id)}}">
                                        <img src="{{v.cover_id|get_pic('m=1,w=50,h=50')}}" width="50" alt="" />
                                    </a>
                                </div>
                                {%endif%}
                                <div class="col-md-9 col-sm-9 col-xs-9">
                                    <a href="{{v.name|get_url(v.id)}}" class="tab-post-link">{{v.title}}</a>
                                    <small>{{v.update_time|dateformat('Y-m-d H:i')}}</small>
                                </div>
                            </div><!-- /post -->
                            {%endfor%}
                            <!-- /post -->
                        </div>
                        <!-- /RECENT -->

                    </div>

                </div>
                <!-- JUSTIFIED TAB -->


                <!-- TAGS -->
                <h3 class="hidden-xs size-16 margin-bottom-10">标签</h3>
                <div class="hidden-xs margin-bottom-20">
                    {% keywords data ="kws",type="hot"%}
                    {%for key in kws%}
                    <a class="tag" href="{{key.url}}">
                        <span class="txt">{{key.keyname}}</span>
                        <span class="num">{{key.videonum}}</span>
                    </a>
                    {%endfor%}
                </div>


                <hr />


                <!-- SOCIAL ICONS -->
                <div class="hidden-xs margin-top-30 margin-bottom-60">
                    <a href="#" class="social-icon social-icon-border social-facebook pull-left" data-toggle="tooltip" data-placement="top" title="Facebook">
                        <i class="icon-facebook"></i>
                        <i class="icon-facebook"></i>
                    </a>

                    <a href="#" class="social-icon social-icon-border social-twitter pull-left" data-toggle="tooltip" data-placement="top" title="Twitter">
                        <i class="icon-twitter"></i>
                        <i class="icon-twitter"></i>
                    </a>

                    <a href="#" class="social-icon social-icon-border social-gplus pull-left" data-toggle="tooltip" data-placement="top" title="Google plus">
                        <i class="icon-gplus"></i>
                        <i class="icon-gplus"></i>
                    </a>

                    <a href="#" class="social-icon social-icon-border social-linkedin pull-left" data-toggle="tooltip" data-placement="top" title="Linkedin">
                        <i class="icon-linkedin"></i>
                        <i class="icon-linkedin"></i>
                    </a>

                    <a href="#" class="social-icon social-icon-border social-rss pull-left" data-toggle="tooltip" data-placement="top" title="Rss">
                        <i class="icon-rss"></i>
                        <i class="icon-rss"></i>
                    </a>
                </div>

            </div>

        </div>

    </div>
</section>
<!-- / -->
{% endblock %}